#{extends 'main.html' /}
#{set title:'登录页面' /}

<style>
    .page{ background: #0abe74;}
</style>
<script type="text/javascript" src="/public/sui/js/list.js"></script>

<body>
<div class="page-group">
    <div class="page">
        <div class="reg scroll_y">
        	<div class="toptel"><a href="#"><i class="iconfont"></i>登录</a></div>
        	*{<h3>注册认证</h3>}*
          <form>
            <ul>
              <li><input type="text" id="ip_login_name" name="" class="editbox radius5" placeholder="登录名:" value="" /></li>
              <li><input type="password" id="ip_password" name="" class="editbox radius5" placeholder="密码:" spellcheck="false" tabindex="1" value="" /></li>
              <li><input type="button" class="button button-fill  button-big" onclick="loginIn()" value="登录" /></li>
                <li><input type="button" class="button button-fill  button-big button-pink" onclick="regist()" value="注册" /></li>

            </ul>
          </form>
            <div style="text-align: right;">
                <a href="/login/forgotPassword" class="external"><p>忘记密码?</p></a>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">

    $(function () {
        $.init();
    });

    function regist(){
//        var ua = navigator.userAgent.toLowerCase();
//        if(ua.match(/MicroMessenger/i) != "micromessenger") {
//            $.alert('请登录微信再进行注册!');
//            return false;
//        }
        window.location.href = '/regist/index';
    }
    
    function loginIn() {
       var login_name = $('#ip_login_name').val();
        var password = $('#ip_password').val();
        if(login_name == null || login_name == '' || login_name == undefined){
            $.toast('请填写登录名!');
            return ;
        }
        if(password == null || password == '' || password == undefined){
            $.toast('请填写登录名!');
            return ;
        }
        
        $.getJSON('/login/loginIn',{loginName: login_name, password : password},function (data) {
            if(data.success){
                window.location.href = '/';
            }else {
                $.toast(data.msg);
            }
            
        })


    }


</script>
</body>
